package com.swsc.ai.client;

import com.swsc.ai.service.HandlerStrategyFactory;
import com.swsc.ai.service.Strategy;

/**
 * @describe:
 * @author: 容若
 * @created: 2024-08-09 9:17
 */
public class HandlerStrategyClient {
    public static void main(String[] args) {
        String filePath = "C://file/123.xlsx";
        String type = getFileExtension(filePath);
        Strategy strategy = HandlerStrategyFactory.getStrategy(type);
        strategy.executeTask(filePath);
    }

    private static String getFileExtension(String filePath){
        // 解析文件名获取文件扩展名,比如 文档.docx，返回 docx
        String fileExtension = filePath.substring(filePath.lastIndexOf(".")+1);
        return fileExtension;
    }
}
